execute Java Script
Executes the given javaScript
code in the frame and returns the result of the execution.
The type mapping rules are the following:
| JavaScript | Java |
|--------------------|----------------|
| Number | Double |
| String | String |
| Boolean | Boolean |
| null and undefined | null |
| Node | JsObject, Node |
| ArrayBuffer | JsArrayBuffer |
| Array | JsArray |
| Set | JsSet |
| Map | JsMap |
| Object | JsObject |
| Proxy Object | Object |
Proxy objects are mapped to the corresponding injected Java object.
Important: This method blocks the current thread execution and waits until the passed JavaScript code has been executed completely. The time required to complete the execution can be different depending on the passed JavaScript code. So, it is strongly recommended that the method is not invoked in the application UI thread.
Return
the result of the execution. Can be null
if the result of the execution on JavaScript is null
or undefined
Parameters
a string that represents JavaScript code to execute
the result type according to the type mapping rules
Throws
when the frame is closed
when javaScript
is empty
Executes the given javaScript
code in the frame and returns the result of the execution through the given callback
.
The type mapping rules are the following:
| JavaScript | Java |
|--------------------|----------------|
| Number | Double |
| String | String |
| Boolean | Boolean |
| null and undefined | null |
| Node | JsObject, Node |
| ArrayBuffer | JsArrayBuffer |
| Array | JsArray |
| Set | JsSet |
| Map | JsMap |
| Object | JsObject |
| Proxy Object | Object |
Proxy objects are mapped to the corresponding injected Java object.
This method does not block the current thread execution and executes the given JavaScript code asynchronously.
Parameters
a string that represents JavaScript code to execute
a callback you can use to get the result of the execution. The result type is determined according to the type mapping rules
Throws
when the frame is closed
when javaScript
is empty